package cn.com.gift.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Copyright (C), 2018-2024
 * FileName: WebConfig
 * Author:   Mr
 * Date:     2024/6/11 19:20
 * Description:
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private LoginUserInterceptor loginUserInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration reg = registry.addInterceptor(loginUserInterceptor);
        reg.addPathPatterns("/gift/**");
        reg.addPathPatterns("/sys/user/**");
        reg.excludePathPatterns("/gift/history/add");
        reg.excludePathPatterns("/gift/list");
        reg.excludePathPatterns("/sys/user/login");
    }
}
